<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const host = new WeakMap();
        class User{
            constructor(name){
                this.name =name;
                host.set(this,"https://houdunren.com");
            }
            set url(url){
                if( !/^https?:/i.test(url)){
                    throw new Error("非常网站");
                }
                host.set(this,url)
            }
            get host(){
                return host.get(this)
            }
        }

        let hd= new User("后盾人")
        console.log(hd)
        console.log(hd.name)
        console.log(hd.host)
    </script>
</body>
</html>